#ifndef _DOUBLE_ARRAY_H_
#define _DOUBLE_ARRAY_H_

#include "locker.h"
#include <stdint.h>

#ifdef __cplusplus
extern "C"{
#endif

typedef struct darray darray_t;

typedef int (*darray_item_destroy_func)(void *data);

darray_t *darray_create(uint32_t init_size, locker_t *locker);
void darray_destroy(darray_t **p_self, darray_item_destroy_func destroy);
int darray_insert(darray_t *self, uint32_t index, void *data);
int darray_insert_tail(darray_t *self, void *data);
int darray_remove(darray_t *self, uint32_t index, void **data);
int darray_remove_tail(darray_t *self, void **data);
void *darray_get(darray_t *self, uint32_t index);
void *darray_get_tail(darray_t *self);
uint32_t darray_nums(darray_t *self);

#ifdef __cplusplus
}
#endif

#endif
